﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Bonit_It.ViewModel.Base
{
    using System.ComponentModel;
    using System.Windows.Input;

    /// <summary>
    /// A viewmodel for overview lists. It derives from <see cref="ViewModel"/>
    /// </summary>
    public abstract class ListViewModel :ViewModel
    {
        private string _FilterText;

        /// <summary>
        /// Gets or sets the show details.
        /// </summary>
        /// <value>
        /// The show details.
        /// </value>
        public ICommand ShowDetails { get; set; }
       


        /// <summary>
        /// Gets or sets the source view.
        /// </summary>
        /// <value>
        /// The source view.
        /// </value>
        public ICollectionView SourceView { get; set; }


        /// <summary>
        /// Filter text
        /// </summary>
        public string FilterText
        {
            get
            {
                return _FilterText;
            }
            set
            {
                _FilterText = value;
                if (SourceView != null)
                {
                    SourceView.Refresh();
                    OnPropertyChanged("FilterText");
                }
            }
        }

        /// <summary>
        /// Filters the specified elements.
        /// </summary>
        /// <param name="o">The o.</param>
        /// <returns></returns>
        public abstract bool Filter(object o);
    }
}
